VitestのSnapshot Testing
VitestのSnapshot Testing
docs
#wip
vi.toMatchSnapshot
vi.toMatchInlineSnapshot
vi.toMatchFileSnapshot
https://vitest.dev/guide/snapshot#file-snapshots
特定のfileをsnapshot fileとして使用する
vi.toMatchImageSnapshot
画像に対するsnapshot testing
別途jest-image-snapshotをinstallする必要がある
https://vitest.dev/guide/snapshot#image-snapshots
vi.expect.addSnapshotSerializer
https://vitest.dev/guide/snapshot#custom-serializer
vi.toThrowErrorMatchingSnapshot
vi.toThrowErrorMatchingInlineSnapshot
snapshotの中身を更新する
$ vitest -u
あるいはwatch modeの状態でu
https://zenn.dev/bs_kansai/articles/943c0c015ed41b
Vitestをwatchモードで実行しているときにuを押せばsnapを更新できる